package com.example.demos.mapper;

import com.example.demos.dto.OrderDetailsDTO;
import com.example.demos.dto.OrdersByGoodsDTO;
import com.example.demos.dto.OrdersDTO;
import com.example.demos.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrdersMapper {
    List<OrdersDTO> select(@Param("state") String state);

    List<Supplier> showSupplier(String type);
    int supplierSum();
    List<OrdersByGoodsDTO> select1();
    int add(@Param("e") OrderDetailsDTO e,@Param("uuid") BigInteger uuid,@Param("state") String state);

    int doCheck(@Param("id") Integer id,@Param("orders") Orders orders);

    int doStart(@Param("id") Integer id,@Param("orders") Orders orders);

    void addOrders(@Param("orders") Orders orders);


    OrderDetail selectOrderDetail(@Param("ordersDetailUuid") BigInteger ordersDetailUuid);

    int selectStoreGoodsSum(@Param("storeUuid") BigInteger storeUuid, @Param("goodsUuid")BigInteger goodsUuid);

    void addStoreDetailByCount(@Param("storeUuid") BigInteger storeUuid,
                               @Param("goodsUuid") BigInteger goodsUuid,
                               @Param("num") BigInteger num);

    void updateStoreDetailByCount(@Param("storeUuid") BigInteger storeUuid,
                                  @Param("goodsUuid") BigInteger goodsUuid,
                                  @Param("num") BigInteger num);

    void updateOrderDetailState(@Param("ordersDetailUuid") BigInteger ordersDetailUuid,
                                @Param("endTime") LocalDateTime now,
                                @Param("endName") String username,
                                @Param("storeUuid") BigInteger storeUuid);

    int selectOrderDetailByOrdersUuid(@Param("ordersUuid") BigInteger ordersUuid);


    void updateOrdersEnd(@Param("endTime") LocalDateTime now,
                         @Param("endName") String username,
                         @Param("ordersUuid") BigInteger ordersUuid);

    int selectEmpIdByUsername(@Param("username") String username);

    int insertStoreOper(@Param("empId") int empId,
                        @Param("endTime") LocalDateTime endTime,
                        @Param("storeUuid") BigInteger storeUuid,
                        @Param("goodsUuid") BigInteger goodsUuid,
                        @Param("num") BigInteger num);
}
